﻿using System.Data.Entity;
using System.Threading.Tasks;
using System.Web.Http;
using d1Common;
using d1Common.WebController;
using d1Project.Modules.Common.doLog.Services;
using Newtonsoft.Json;

namespace d1Project.Modules.Common.do4A.Controllers.a
{ 
        /// <summary>
        /// 坐席挂机数据推送
        /// </summary>
    [Route("api/callHook")]
    public class callHookController : ControllerBase
    {
        protected override DbContext dbContext
        {
            get
            {
                return null;
            }
        }
        private do4ADbContext db = new do4ADbContext();

        [HttpPost]
        public async Task<IHttpActionResult> Post([FromBody]GetVmcallHook callhook)
        {
            Res res = new Res();

            doServices.Instance.DoLog.Info("ts", "坐席挂机数据推送");

            if (callhook != null)
            {
                var data = JsonConvert.DeserializeObject<PostVmcallHook>(callhook.data);

                doServices.Instance.DoLog.Info("ts", "坐席挂机数据推送数据为：" + "customerNo:" + data.customerNo + "," + "phone:" + data.phone + "," + "reportNum:" + data.reportNum + "," + "uqid:" + data.uqid + "calleeOffHookTime:" + data.calleeOnHookTime + "onHookType:" + data.onHookType);
            }
            res.status = true;
            res.message = "调用接口成功";

            return Ok(res);
        }
    }

    public class GetVmcallHook
    {
        public string data { get; set; }
    }

    public class PostVmcallHook
    {
        /// <summary>
        /// 
        /// </summary>
        public string customerNo { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string phone { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string reportNum { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string uqid { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string calleeOnHookTime { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string onHookType { get; set; }
    }


    public class Res
    {
        public bool status { get; set; }
        public string message { get; set; }
    }
}